package create;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import login.login;

import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.Font;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JCheckBox;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class CreateUser extends JFrame {

	private JPanel contentPane;
	int flag;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		new CreateUser();
	}

	/**
	 * Create the frame.
	 */
	public CreateUser() {
		this.setVisible(true);
		setBackground(Color.LIGHT_GRAY);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(700, 400, 326, 228);
		setLocationRelativeTo(getOwner());
		setResizable(false);
		contentPane = new JPanel();
		contentPane.setBackground(Color.LIGHT_GRAY);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JPanel panel = new JPanel();
		panel.setBounds(121, 185, -12, 1);
		contentPane.add(panel);
		
		JLabel lblNewLabel = new JLabel("新建用户");
		lblNewLabel.setFont(new Font("Lucida Grande", Font.PLAIN, 18));
		lblNewLabel.setBounds(109, 6, 96, 27);
		contentPane.add(lblNewLabel);
		
		JLabel lblNewLabel_1 = new JLabel("请问你是");
		lblNewLabel_1.setFont(new Font("Lucida Grande", Font.PLAIN, 15));
		lblNewLabel_1.setBounds(54, 91, 67, 27);
		contentPane.add(lblNewLabel_1);
		
		JRadioButton rdbtnNewRadioButton = new JRadioButton("老师");
		rdbtnNewRadioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				flag = 2;
			}
		});
		rdbtnNewRadioButton.setBounds(137, 63, 141, 23);
		contentPane.add(rdbtnNewRadioButton);
		
		JRadioButton radioButton = new JRadioButton("学生");
		radioButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				flag = 1;
			}
		});
		radioButton.setBounds(137, 113, 141, 23);
		contentPane.add(radioButton);
		ButtonGroup b = new ButtonGroup();
		b.add(radioButton);
		b.add(rdbtnNewRadioButton);
		
		JButton btnNewButton = new JButton("下一步");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(flag == 1){
					new StuInfo();
					setVisible(false);
				}else if(flag == 2){
					new TeaInfo();
					setVisible(false);
				}
				else {
					JOptionPane.showMessageDialog(null,"请勾选信息","信息提示框",JOptionPane.INFORMATION_MESSAGE);
				}
					
			}
		});
		btnNewButton.setBounds(184, 157, 96, 29);
		contentPane.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("返回");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new login();
				setVisible(false);
			}
		});
		btnNewButton_1.setBounds(51, 157, 96, 29);
		contentPane.add(btnNewButton_1);
	}
}
